import domain.Shape;

import java.util.ArrayList;
import java.util.List;

public class Main {
    //jdk1.8新特性的个人理解
    public static void main(String[] args) {
        //数据的构造
        List<Shape> shapes=new ArrayList<Shape>();
        for (int i=0;i<10;i++){
            shapes.add(new Shape());
        }


        //新特性迭代: 使用Java类库进行迭代
        shapes.forEach(shape -> {
            if (shape.getColor()==null) {
                shape.setColor("red");
                System.out.println(shape.getColor());
            }
        });
        //原始迭代:这种是属于客户端代码迭代
        for (Shape shape : shapes) {
            if (shape.getColor()==null) {
                shape.setColor("red");
                System.out.println(shape.getColor());
            }
        }
        /**
         * Java类库迭代与客户端代码迭代的区别有哪些?
         *
         */
    }
}
